layui.use('table', function(){
    let table = layui.table
    table.render({
        elem: '#studentlist',
        url: apiurl + "/sys/student",
        toolbar: '#titlebar',
        cols: [[
            {field: 'id', title: '', type: 'checkbox', align: 'center'},
            {field: 'sdtcode', title: '学号', width: 80, sort: true, align: 'center'},
            {field: 'sdtname', title: '姓名', width: 100},
            {field: 'gender', title: '性别', width: 80},
            {field: 'birthdate', title: '出生日期', width: 120},
            {field: 'enterdate', title: '入校日期', width: 120},
            {field: 'classname', title: '班级名称'},
            {fixed: 'right', title:'操作', toolbar: '#colbar', width:175, align: 'center'},
        ]],
        page: true,
        even: true,
        limits: [10, 15, 20],
        limit:10,
        parseData: function(res) {
            let rst

            if (this.page.curr) {
                rst = res.slice(this.limit * (this.page.curr - 1), this.limit * this.page.curr)
            }
            else {
                rst = res.slice(0, this.limit)
            }

            return {
                "code": 0,
                "data": rst,
                "count": res.length,
                "msg": res.message
            }
        },
    })
})
